package com.love_weinuo.ui.fragment;

import android.annotation.SuppressLint;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.love_weinuo.R;
import com.love_weinuo.databinding.FragmentPageBinding;

/**
 * Created by Administrator on 2018/10/8 0008.
 */

@SuppressLint("ValidFragment")
public class PageFragment extends BaseLazyFragment {

    private int mPosition = 0;
    private FragmentPageBinding pageBinding;

    @SuppressLint("ValidFragment")
    public PageFragment(int position){
        this.mPosition = position;
    }

    @Override
    protected View inflaterView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        pageBinding = DataBindingUtil.inflate(LayoutInflater.from(getActivity()), R.layout.fragment_page, container, false);
        pageBinding.setFragment(this);
        return pageBinding.getRoot();
    }

    @Override
    protected void onVisible() {

    }

    @Override
    protected void lazyLoad() {

    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        switch (mPosition) {
            case 0:
                pageBinding.img.setImageResource(R.drawable.icon_guide_first);
                break;
            case 1:
                pageBinding.img.setImageResource(R.drawable.icon_guide_second);
                break;
            case 2:
                pageBinding.img.setImageResource(R.drawable.icon_third);
                break;
            case 3:
                pageBinding.img.setImageResource(R.drawable.icon_guide_forth);
                break;
            default:
        }
    }

    @Override
    public int setLayoutId() {
        return R.layout.fragment_page;
    }
}
